 <template>
  <el-table
    ref="singleTable"
    :data="reset"
    @selection-change="handleSelectionChange"
    border
    style="width: 100%"
    :header-cell-style="{background:'#f4f4f4'}"
  >
    <el-table-column 
    fixed 
    type="selection"
    align="center"
    width="50">
    </el-table-column>
    <el-table-column 
    type="index"
    label="序号"
    align="center"
    width="55">
    </el-table-column>
    <el-table-column
    prop="Code" 
    align="center"
    label="仓库编码">
    </el-table-column>
    <el-table-column 
    prop="Name" 
    align="center"
    label="仓库名称">
    </el-table-column>
    <el-table-column 
    prop="StatusFormat"  
    align="center"
    label="是否启用">
    </el-table-column>
    <el-table-column 
    prop="WareHouseTypeFormat" 
    align="center"
    label="仓库类型">
    </el-table-column>
    <el-table-column 
    prop="FullCapacity" 
    align="center"
    label="满仓数">
    </el-table-column>
    <el-table-column 
    prop="IsSale" 
    :formatter="format2"
    align="center"
    label="是否可销售">
    </el-table-column>
    <el-table-column 
    prop="IsScheduling"
    :formatter="format3" 
    align="center"
    label="是否可排产">
    </el-table-column>
    <el-table-column 
    prop="IsWork" 
    :formatter="format4"
    align="center"
    label="是否可生产">
    </el-table-column>
    <el-table-column 
    prop="CreateByFormat" 
    align="center"
    label="创建人">
    </el-table-column>
    <el-table-column 
    prop="CreateTime"
    :show-overflow-tooltip="true" 
    align="center"
    label="创建时间">
    </el-table-column>
    
  </el-table>
  
</template>

  <script>
export default {
  props: {
    reset: {
      type: Array
    }
  },
  data() {
    return {
  
    };
  },
  methods: {
    handleSelectionChange(val){
      this.$emit('changeData',val)
      let listId=[]
      val.forEach(el => {
          listId.push(el.WareHouseId)
      });
      this.$emit('getId',listId)          
    },  
    format2(row, column, cellValue, index){
      if(row.IsSale==1){
        return '可以'
      }else{
        return '不可以'
      }
    },
    format3(row,column,cellValue,index){  
      if(row.IsScheduling == 1){
        return "可以"
      }else{
        return "不可以"
      }
    },
    format4(row,column,cellValue,index){  
      if(row.IsWork == 1){
        return "可以"
      }else{
        return "不可以"
      }
    },
    // rowClassName({row, rowIndex}){
    //   //把每一行的索引放进row.id
    //   row.WareHouseId = rowIndex+1;
    // }
  }
};
</script>